package com.qf.sy2103.ssm.controller;

import com.qf.sy2103.ssm.vo.UserVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/test")
public class TestController {

    // http://localhost:8080/test/test1
    @RequestMapping("/test1")
    public String test1( String aaa){
        System.out.println("TestController test1");
        return "redirect:/index.html";  // 重定向
    }

    // http://localhost:8080/test/test2
    @RequestMapping("/test2")
    @ResponseBody   // 如果要返回json数据，不要忘记加这个注解
    public UserVo test2(){
        final UserVo userVo = new UserVo();
        userVo.setId(100);
        userVo.setName("jack");
        return userVo;
    }

}
